package com.api.volunteer.controller;

import com.api.volunteer.util.Result;
import org.springframework.http.HttpStatus;

import java.util.function.Supplier;

/**
 * @author 邹宇杰
 * @email 2901570623@qq.com
 * @date 2022/3/29 21:43
 */
public class BaseController {

    public <T> Result processData(Supplier<T> supplier){
        Result result = new Result();
        T t = supplier.get();
        result.put("code", HttpStatus.OK.value());
        result.put("data", t);
        return result;
    }

    public Result processSuceess(){
        Result result = new Result();
        result.put("code", HttpStatus.OK.value());
        result.put("status", HttpStatus.OK.getReasonPhrase());
        return  result;
    }

}
